Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v3.8.5] Support inline enum and mangle private variables to reduce engine size. #17703

Open
wants to merge 57 commits into
base: v3.8.5
Choose a base branch
from

Conversation

dumganhar
Copy link
Contributor

@dumganhar dumganhar commented Oct 12, 2024

Re: #15287

After merging this PR,package size could reduce nearly 180KB.

Inline enum

// Original code

export enum TileFlag {
    HORIZONTAL = 0x80000000,
    VERTICAL = 0x40000000,
    DIAGONAL = 0x20000000,
    FLIPPED_ALL = (0x80000000 | 0x40000000 | 0x20000000 | 0x10000000) >>> 0,
    FLIPPED_MASK = (~(0x80000000 | 0x40000000 | 0x20000000 | 0x10000000)) >>> 0
}

console.log(TileFlag.HORIZONTAL);
console.log(TileFlag.VERTICAL);
console.log(TileFlag.DIAGONAL);
console.log(TileFlag.FLIPPED_ALL);
console.log(TileFlag.FLIPPED_MASK);

// Inlined

var TileFlag = exports("TileFlag", {
    "HORIZONTAL": 2147483648,
    "VERTICAL": 1073741824,
    "DIAGONAL": 536870912,
    "FLIPPED_ALL": 4026531840,
    "FLIPPED_MASK": 268435455
  });
  console.log(2147483648);
  console.log(1073741824);
  console.log(536870912);
  console.log(4026531840);
  console.log(268435455);

Mangle variables using terser configuration

The variables with name ends with $ will be mangled to shorter name.

For example, _myVariable$ may be mangled to ae.

Changelog


Continuous Integration

This pull request:

  • needs automatic test cases check.

    Manual trigger with @cocos-robot run test cases afterward.

  • does not change any runtime related code or build configuration

    If any reviewer thinks the CI checks are needed, please uncheck this option, then close and reopen the issue.


Compatibility Check

This pull request:

  • changes public API, and have ensured backward compatibility with deprecated features.
  • affects platform compatibility, e.g. system version, browser version, platform sdk version, platform toolchain, language version, hardware compatibility etc.
  • affects file structure of the build package or build configuration which requires user project upgrade.
  • introduces breaking changes, please list all changes, affected features and the scope of violation.

@dumganhar dumganhar requested a review from minggo October 12, 2024 08:11
@dumganhar dumganhar changed the title [v3.8.5] Support inline enum for engine code. [v3.8.5] Support inline enum and mangle private variables to reduce engine size. Oct 12, 2024
@@ -262,7 +266,7 @@ export class SpriteFrame extends Asset {
* @en uv update event.
* @zh uv 更新事件。
*/
public static EVENT_UV_UPDATED = 'uv_updated';
public static EVENT_UV_UPDATED = SpriteFrameEvent.UV_UPDATED;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We only inline enums, doesn't support to inline static const varibles in class.
So define a enum for those constants.

Copy link

github-actions bot commented Oct 12, 2024

Interface Check Report

! WARNING this pull request has changed these public interfaces:

@@ -758,8 +758,11 @@
          * @zh 是否转置 UV。
          */
         isFlipUv?: boolean;
     }
+    export enum SpriteFrameEvent {
+        UV_UPDATED = "uv_updated"
+    }
     /**
      * @en
      * A `SpriteFrame` support several types.
      *  1. Rectangle sprite frame
@@ -844,9 +847,9 @@
         /**
          * @en uv update event.
          * @zh uv 更新事件。
          */
-        static EVENT_UV_UPDATED: string;
+        static EVENT_UV_UPDATED: SpriteFrameEvent;
         static MeshType: typeof __private._cocos_2d_assets_sprite_frame__MeshType;
         /**
          * @en Top border distance of sliced 9 rect.
          * @zh 九宫格内部矩形顶部边框距离 SpriteFrame 矩形的距离。
@@ -2368,9 +2371,9 @@
         /**
          * @en Event types for sprite.
          * @zh sprite 的事件类型。
          */
-        static EventType: typeof __private._cocos_2d_components_sprite__EventType;
+        static EventType: typeof __private._cocos_2d_components_sprite__SpriteEventType;
         protected _spriteFrame: SpriteFrame | null;
         protected _type: __private._cocos_2d_components_sprite__SpriteType;
         protected _fillType: __private._cocos_2d_components_sprite__FillType;
         protected _sizeMode: __private._cocos_2d_components_sprite__SizeMode;
@@ -6323,9 +6326,9 @@
          * @see [[playOnLoad]]
          */
         get defaultClip(): AnimationClip | null;
         set defaultClip(value: AnimationClip | null);
-        static EventType: typeof __private._cocos_animation_animation_state__EventType;
+        static EventType: typeof __private._cocos_animation_animation_state__AnimationStateEventType;
         /**
          * @en
          * Whether the default clip should get into playing when this components starts.
          * Note, this field takes no effect if `crossFade()` or `play()` has been called before this component starts.
@@ -6468,10 +6471,10 @@
          * // register event to all animation
          * animation.on('play', this.onPlay, this);
          * ```
          */
-        on<TFunction extends (...any: any[]) => void>(type: __private._cocos_animation_animation_state__EventType, callback: TFunction, thisArg?: any, once?: boolean): TFunction;
-        once<TFunction extends (...any: any[]) => void>(type: __private._cocos_animation_animation_state__EventType, callback: TFunction, thisArg?: any): TFunction;
+        on<TFunction extends (...any: any[]) => void>(type: __private._cocos_animation_animation_state__AnimationStateEventType, callback: TFunction, thisArg?: any, once?: boolean): TFunction;
+        once<TFunction extends (...any: any[]) => void>(type: __private._cocos_animation_animation_state__AnimationStateEventType, callback: TFunction, thisArg?: any): TFunction;
         /**
          * @en
          * Unregister animation event callback.
          * @zh
@@ -6484,9 +6487,9 @@
          * // unregister event to all animation
          * animation.off('play', this.onPlay, this);
          * ```
          */
-        off(type: __private._cocos_animation_animation_state__EventType, callback?: (...any: any[]) => void, thisArg?: any): void;
+        off(type: __private._cocos_animation_animation_state__AnimationStateEventType, callback?: (...any: any[]) => void, thisArg?: any): void;
         /**
          * @internal
          */
         protected _createState(clip: AnimationClip, name?: string): AnimationState;
@@ -10779,9 +10782,12 @@
                  * @internal
                  */
                 usage?: CameraUsage;
             }
-            export const SKYBOX_FLAG: number;
+            export enum SkyBoxFlagValue {
+                VALUE = 8
+            }
+            export const SKYBOX_FLAG: SkyBoxFlagValue;
             /**
              * @en The render camera representation in the render scene, it's managed by [[Camera]]
              * @zh 渲染场景中的相机对象,由项目层的 [[Camera]] 管理。
              */
@@ -11865,34 +11871,34 @@
                 protected _mipmapCount: number;
                 protected _enabled: boolean;
                 initialize(ambientInfo: AmbientInfo): void;
             }
-            export const EnvironmentLightingType: {
+            export enum EnvironmentLightingType {
                 /**
                  * @zh
                  * 半球漫反射
                  * @en
                  * hemisphere diffuse
                  * @readonly
                  */
-                HEMISPHERE_DIFFUSE: number;
+                HEMISPHERE_DIFFUSE = 0,
                 /**
                  * @zh
                  * 半球漫反射和环境反射
                  * @en
                  * hemisphere diffuse and Environment reflection
                  * @readonly
                  */
-                AUTOGEN_HEMISPHERE_DIFFUSE_WITH_REFLECTION: number;
+                AUTOGEN_HEMISPHERE_DIFFUSE_WITH_REFLECTION = 1,
                 /**
                  * @zh
                  * 漫反射卷积图和环境反射
                  * @en
                  * diffuse convolution map and environment reflection
                  * @readonly
                  */
-                DIFFUSEMAP_WITH_REFLECTION: number;
-            };
+                DIFFUSEMAP_WITH_REFLECTION = 2
+            }
             /**
              * @en The skybox configuration of the render scene,
              * currently some rendering options like hdr and ibl lighting configuration is also here.
              * @zh 渲染场景的天空盒配置,目前一些渲染配置,比如 HDR 模式和环境光照配置也在 Skybox 中。
@@ -12985,9 +12991,9 @@
                  */
                 update(): void;
             }
             export enum ProbeClearFlag {
-                SKYBOX,
+                SKYBOX = 14,
                 SOLID_COLOR = 7
             }
             export enum ProbeType {
                 CUBE = 0,
@@ -15966,12 +15972,8 @@
              * @returns this
              */
             fromQuat(q: Quat): Mat3;
         }
-        /**
-         * @en Mathematical 4x4 matrix.
-         * @zh 表示四维(4x4)矩阵。
-         */
         export class Mat4 extends ValueType {
             static IDENTITY: Readonly<Mat4>;
             /**
              * @en Clone a matrix and save the results to out matrix
@@ -16012,8 +16014,13 @@
              * @zh 将目标赋值为单位矩阵
              */
             static identity<Out extends IMat4Like>(out: Out): Out;
             /**
+             * @en return an zero matrix.
+             * @zh 将目标赋值为0矩阵
+             */
+            static zero<Out extends IMat4Like>(out: Out): Out;
+            /**
              * @en Transposes a matrix and save the results to out matrix
              * @zh 转置矩阵
              */
             static transpose<Out extends IMat4Like>(out: Out, a: Out): Out;
@@ -16626,18 +16633,18 @@
              * @param out The output vector to store the result
              * @param point Vector to apply transform.
              * @param t transform matrix.
              */
-            static transformVec2(out: Vec2, point: Vec2, t: AffineTransform): any;
+            static transformVec2(out: Vec2, point: Vec2, t: AffineTransform): void;
             /**
              * @en Apply the `AffineTransform` on a 2D vector.
              * @zh 应用二维仿射变换矩阵到二维向量上,并将结果赋值给输出向量。
              * @param out The output vector to store the result
              * @param x x to apply transform.
              * @param y y to apply transform.
              * @param t transform matrix.
              */
-            static transformVec2(out: Vec2, x: number, y: number, t: AffineTransform): any;
+            static transformVec2(out: Vec2, x: number, y: number, t: AffineTransform): void;
             /**
              * @en Apply the `AffineTransform` on a size.
              * @zh 应用二维仿射变换矩阵到二维尺寸上,并将结果赋值给输出尺寸。
              * @param out The output size to store the result
@@ -17867,21 +17874,21 @@
          * The enum type of basic geometry.
          * @zh
          * 形状的类型值。
          */
-        export const enums: {
-            SHAPE_RAY: number;
-            SHAPE_LINE: number;
-            SHAPE_SPHERE: number;
-            SHAPE_AABB: number;
-            SHAPE_OBB: number;
-            SHAPE_PLANE: number;
-            SHAPE_TRIANGLE: number;
-            SHAPE_FRUSTUM: number;
-            SHAPE_FRUSTUM_ACCURATE: number;
-            SHAPE_CAPSULE: number;
-            SHAPE_SPLINE: number;
-        };
+        export enum enums {
+            SHAPE_RAY = 1,
+            SHAPE_LINE = 2,
+            SHAPE_SPHERE = 4,
+            SHAPE_AABB = 8,
+            SHAPE_OBB = 16,
+            SHAPE_PLANE = 32,
+            SHAPE_TRIANGLE = 64,
+            SHAPE_FRUSTUM = 128,
+            SHAPE_FRUSTUM_ACCURATE = 256,
+            SHAPE_CAPSULE = 512,
+            SHAPE_SPLINE = 1024
+        }
         export namespace distance {
             /**
              * @en
              * Calculates the distance between a point and a plane.
@@ -18071,10 +18078,10 @@
              * @zh 终点。
              */
             e: math.Vec3;
             /**
-             * @en Gets the type of the shape. Always returns `enums.SHAPE_LINE`.
-             * @zh 获取形状的类型,总是返回 `enums.SHAPE_LINE`。
+             * @en Gets the type of the shape. Always returns `ShapeType.SHAPE_LINE`.
+             * @zh 获取形状的类型,总是返回 `ShapeType.SHAPE_LINE`。
              */
             get type(): number;
             /**
              * @en Constructs a line.
@@ -18195,11 +18202,11 @@
              */
             d: number;
             /**
              * @en
-             * Gets the type of the Plane, its value is `enums.SHAPE_PLANE`.
+             * Gets the type of the Plane, its value is `ShapeType.SHAPE_PLANE`.
              * @zh
-             * 获取形状的类型,值为 `enums.SHAPE_PLANE`。
+             * 获取形状的类型,值为 `ShapeType.SHAPE_PLANE`。
              */
             get type(): number;
             set x(val: number);
             get x(): number;
@@ -18311,11 +18318,11 @@
              */
             d: math.Vec3;
             /**
              * @en
-             * Gets the type of the ray, its value is `enums.SHAPE_RAY`.
+             * Gets the type of the ray, its value is `ShapeType.SHAPE_RAY`.
              * @zh
-             * 获取形状的类型,其值为`enums.SHAPE_RAY`。
+             * 获取形状的类型,其值为`ShapeType.SHAPE_RAY`。
              */
             get type(): number;
             protected readonly _type: number;
             /**
@@ -18436,11 +18443,11 @@
              */
             c: math.Vec3;
             /**
              * @en
-             * Gets the type of the triangle, always returns `enums.SHAPE_TRIANGLE`.
+             * Gets the type of the triangle, always returns `ShapeType.SHAPE_TRIANGLE`.
              * @zh
-             * 获取此三角形的类型,固定返回 `enums.SHAPE_TRIANGLE`。
+             * 获取此三角形的类型,固定返回 `ShapeType.SHAPE_TRIANGLE`。
              */
             get type(): number;
             protected readonly _type: number;
             /**
@@ -18541,11 +18548,11 @@
             get radius(): number;
             set radius(val: number);
             /**
              * @en
-             * Gets the type of the shape, always returns `enums.SHAPE_SPHERE`.
+             * Gets the type of the shape, always returns `ShapeType.SHAPE_SPHERE`.
              * @zh
-             * 获取球的类型,固定返回 `enums.SHAPE_SPHERE`。
+             * 获取球的类型,固定返回 `ShapeType.SHAPE_SPHERE`。
              */
             get type(): number;
             protected readonly _type: number;
             /**
@@ -18928,11 +18935,11 @@
              */
             orientation: math.Mat3;
             /**
              * @en
-             * Gets the type of the OBB. Always returns `enums.SHAPE_OBB`.
+             * Gets the type of the OBB. Always returns `ShapeType.SHAPE_OBB`.
              * @zh
-             * 获取形状的类型,固定返回 `enums.SHAPE_OBB`。
+             * 获取形状的类型,固定返回 `ShapeType.SHAPE_OBB`。
              */
             get type(): number;
             protected readonly _type: number;
             /**
@@ -19005,11 +19012,11 @@
          */
         export class Capsule {
             /**
              * @en
-             * Gets the type of this Capsule, always returns `enums.SHAPE_CAPSULE`.
+             * Gets the type of this Capsule, always returns `ShapeType.SHAPE_CAPSULE`.
              * @zh
-             * 获取此形状的类型,值固定为 `enums.SHAPE_CAPSULE`。
+             * 获取此形状的类型,值固定为 `ShapeType.SHAPE_CAPSULE`。
              */
             get type(): number;
             protected readonly _type: number;
             /**
@@ -19191,11 +19198,11 @@
              */
             set accurate(b: boolean);
             /**
              * @en
-             * Gets the type of the shape. The value may be `enums.SHAPE_FRUSTUM_ACCURATE` or `enums.SHAPE_FRUSTUM`.
+             * Gets the type of the shape. The value may be `ShapeType.SHAPE_FRUSTUM_ACCURATE` or `ShapeType.SHAPE_FRUSTUM`.
              * @zh
-             * 获取形状的类型。值可能为 `enums.SHAPE_FRUSTUM_ACCURATE` 或 `enums.SHAPE_FRUSTUM`。
+             * 获取形状的类型。值可能为 `ShapeType.SHAPE_FRUSTUM_ACCURATE` 或 `ShapeType.SHAPE_FRUSTUM`。
              * @readonly
              */
             get type(): number;
             /**
@@ -19423,11 +19430,11 @@
              */
             static copy(out: Spline, s: Spline): Spline;
             /**
              * @en
-             * Gets the type of this Spline instance, always returns `enums.SHAPE_SPLINE`.
+             * Gets the type of this Spline instance, always returns `ShapeType.SHAPE_SPLINE`.
              * @zh
-             * 获取此 Spline 的类型,固定返回 `enums.SHAPE_SPLINE`
+             * 获取此 Spline 的类型,固定返回 `ShapeType.SHAPE_SPLINE`
              */
             get type(): number;
             /**
              * @en
@@ -22858,16 +22865,38 @@
         getRandomColor(out: math.Color): math.Color;
     }
     /**
      * @zh
+     * Settings 中的默认分组,通常与模块一一对应。
+     *
+     * @en
+     * The default grouping in Settings, which usually corresponds to the module.
+     */
+    export enum SettingsCategory {
+        PATH = "path",
+        ENGINE = "engine",
+        ASSETS = "assets",
+        SCRIPTING = "scripting",
+        PHYSICS = "physics",
+        RENDERING = "rendering",
+        LAUNCH = "launch",
+        SCREEN = "screen",
+        SPLASH_SCREEN = "splashScreen",
+        ANIMATION = "animation",
+        PROFILING = "profiling",
+        PLUGINS = "plugins",
+        XR = "xr"
+    }
+    /**
+     * @zh
      * 配置模块用于获取 settings.json 配置文件中的配置信息,同时你可以覆盖一些配置从而影响引擎的启动和运行,可参考 [game.init] 的参数选项说明。你可以通过 [settings] 访问此模块单例。
      * @en
      * The Settings module is used to get the configuration information in the settings.json configuration file,
      * and you can override some of the configuration to affect the launch and running of the engine, as described in the [game.init] parameter options.
      * You can access this single instance of the module via [settings].
      */
     export class Settings {
-        static Category: typeof __private._cocos_core_settings__Category;
+        static Category: typeof SettingsCategory;
         /**
          * Initialization
          * @internal
          */
@@ -22884,14 +22913,14 @@
          * @param value @en The value of the configuration you want to override. @zh 想要覆盖的具体值。
          *
          * @example
          * ```ts
-         * console.log(settings.querySettings(Settings.Category.ASSETS, 'server')); // print https://www.cocos.com
-         * settings.overrideSettings(Settings.Category.ASSETS, 'server', 'http://www.test.com');
-         * console.log(settings.querySettings(Settings.Category.ASSETS, 'server')); // print http://www.test.com
+         * console.log(settings.querySettings(SettingsCategory.ASSETS, 'server')); // print https://www.cocos.com
+         * settings.overrideSettings(SettingsCategory.ASSETS, 'server', 'http://www.test.com');
+         * console.log(settings.querySettings(SettingsCategory.ASSETS, 'server')); // print http://www.test.com
          * ```
          */
-        overrideSettings<T = any>(category: __private._cocos_core_settings__Category | string, name: string, value: T): void;
+        overrideSettings<T = any>(category: SettingsCategory | string, name: string, value: T): void;
         /**
          * @zh
          * 查询配置模块中具体分组中的具体配置值。
          *
@@ -22903,15 +22932,15 @@
          * @returns @en The value of configuration to query. @zh 想要查询的具体配置值。
          *
          * @example
          * ```ts
-         * console.log(settings.querySettings(Settings.Category.ENGINE, 'debug')); // print false
+         * console.log(settings.querySettings(SettingsCategory.ENGINE, 'debug')); // print false
          * ```
          */
-        querySettings<T = any>(category: __private._cocos_core_settings__Category | string, name: string): T | null;
+        querySettings<T = any>(category: SettingsCategory | string, name: string): T | null;
     }
     export namespace Settings {
-        export type Category = typeof __private._cocos_core_settings__Category;
+        export type Category = typeof SettingsCategory;
     }
     /**
      * @zh
      * Settings 模块单例,你能通过此单例访问 settings.json 中的配置数据。
@@ -23340,94 +23369,153 @@
             SAMPLER_REFLECTION_PROBE_BLEND_CUBE = 18,
             COUNT = 19
         }
         export const bindingMappingInfo: gfx.BindingMappingInfo;
+        export enum UBOGlobalEnum {
+            TIME_OFFSET = 0,
+            SCREEN_SIZE_OFFSET = 4,
+            NATIVE_SIZE_OFFSET = 8,
+            PROBE_INFO_OFFSET = 12,
+            DEBUG_VIEW_MODE_OFFSET = 16,
+            COUNT = 20,
+            SIZE = 80
+        }
         /**
          * @en The global uniform buffer object
          * @zh 全局 UBO。
          */
         export class UBOGlobal {
-            static readonly TIME_OFFSET = 0;
-            static readonly SCREEN_SIZE_OFFSET: number;
-            static readonly NATIVE_SIZE_OFFSET: number;
-            static readonly PROBE_INFO_OFFSET: number;
-            static readonly DEBUG_VIEW_MODE_OFFSET: number;
-            static readonly COUNT: number;
-            static readonly SIZE: number;
+            static readonly TIME_OFFSET: UBOGlobalEnum;
+            static readonly SCREEN_SIZE_OFFSET: UBOGlobalEnum;
+            static readonly NATIVE_SIZE_OFFSET: UBOGlobalEnum;
+            static readonly PROBE_INFO_OFFSET: UBOGlobalEnum;
+            static readonly DEBUG_VIEW_MODE_OFFSET: UBOGlobalEnum;
+            static readonly COUNT: UBOGlobalEnum;
+            static readonly SIZE: UBOGlobalEnum;
             static readonly NAME = "CCGlobal";
             static readonly BINDING = PipelineGlobalBindings.UBO_GLOBAL;
             static readonly DESCRIPTOR: gfx.DescriptorSetLayoutBinding;
             static readonly LAYOUT: gfx.UniformBlock;
         }
+        export enum UBOCameraEnum {
+            MAT_VIEW_OFFSET = 0,
+            MAT_VIEW_INV_OFFSET = 16,
+            MAT_PROJ_OFFSET = 32,
+            MAT_PROJ_INV_OFFSET = 48,
+            MAT_VIEW_PROJ_OFFSET = 64,
+            MAT_VIEW_PROJ_INV_OFFSET = 80,
+            CAMERA_POS_OFFSET = 96,
+            SURFACE_TRANSFORM_OFFSET = 100,
+            SCREEN_SCALE_OFFSET = 104,
+            EXPOSURE_OFFSET = 108,
+            MAIN_LIT_DIR_OFFSET = 112,
+            MAIN_LIT_COLOR_OFFSET = 116,
+            AMBIENT_SKY_OFFSET = 120,
+            AMBIENT_GROUND_OFFSET = 124,
+            GLOBAL_FOG_COLOR_OFFSET = 128,
+            GLOBAL_FOG_BASE_OFFSET = 132,
+            GLOBAL_FOG_ADD_OFFSET = 136,
+            NEAR_FAR_OFFSET = 140,
+            VIEW_PORT_OFFSET = 144,
+            COUNT = 148,
+            SIZE = 592
+        }
         /**
          * @en The global camera uniform buffer object
          * @zh 全局相机 UBO。
          */
         export class UBOCamera {
-            static readonly MAT_VIEW_OFFSET = 0;
-            static readonly MAT_VIEW_INV_OFFSET: number;
-            static readonly MAT_PROJ_OFFSET: number;
-            static readonly MAT_PROJ_INV_OFFSET: number;
-            static readonly MAT_VIEW_PROJ_OFFSET: number;
-            static readonly MAT_VIEW_PROJ_INV_OFFSET: number;
-            static readonly CAMERA_POS_OFFSET: number;
-            static readonly SURFACE_TRANSFORM_OFFSET: number;
-            static readonly SCREEN_SCALE_OFFSET: number;
-            static readonly EXPOSURE_OFFSET: number;
-            static readonly MAIN_LIT_DIR_OFFSET: number;
-            static readonly MAIN_LIT_COLOR_OFFSET: number;
-            static readonly AMBIENT_SKY_OFFSET: number;
-            static readonly AMBIENT_GROUND_OFFSET: number;
-            static readonly GLOBAL_FOG_COLOR_OFFSET: number;
-            static readonly GLOBAL_FOG_BASE_OFFSET: number;
-            static readonly GLOBAL_FOG_ADD_OFFSET: number;
-            static readonly NEAR_FAR_OFFSET: number;
-            static readonly VIEW_PORT_OFFSET: number;
-            static readonly COUNT: number;
-            static readonly SIZE: number;
+            static readonly MAT_VIEW_OFFSET: UBOCameraEnum;
+            static readonly MAT_VIEW_INV_OFFSET: UBOCameraEnum;
+            static readonly MAT_PROJ_OFFSET: UBOCameraEnum;
+            static readonly MAT_PROJ_INV_OFFSET: UBOCameraEnum;
+            static readonly MAT_VIEW_PROJ_OFFSET: UBOCameraEnum;
+            static readonly MAT_VIEW_PROJ_INV_OFFSET: UBOCameraEnum;
+            static readonly CAMERA_POS_OFFSET: UBOCameraEnum;
+            static readonly SURFACE_TRANSFORM_OFFSET: UBOCameraEnum;
+            static readonly SCREEN_SCALE_OFFSET: UBOCameraEnum;
+            static readonly EXPOSURE_OFFSET: UBOCameraEnum;
+            static readonly MAIN_LIT_DIR_OFFSET: UBOCameraEnum;
+            static readonly MAIN_LIT_COLOR_OFFSET: UBOCameraEnum;
+            static readonly AMBIENT_SKY_OFFSET: UBOCameraEnum;
+            static readonly AMBIENT_GROUND_OFFSET: UBOCameraEnum;
+            static readonly GLOBAL_FOG_COLOR_OFFSET: UBOCameraEnum;
+            static readonly GLOBAL_FOG_BASE_OFFSET: UBOCameraEnum;
+            static readonly GLOBAL_FOG_ADD_OFFSET: UBOCameraEnum;
+            static readonly NEAR_FAR_OFFSET: UBOCameraEnum;
+            static readonly VIEW_PORT_OFFSET: UBOCameraEnum;
+            static readonly COUNT: UBOCameraEnum;
+            static readonly SIZE: UBOCameraEnum;
             static readonly NAME = "CCCamera";
             static readonly BINDING = PipelineGlobalBindings.UBO_CAMERA;
             static readonly DESCRIPTOR: gfx.DescriptorSetLayoutBinding;
             static readonly LAYOUT: gfx.UniformBlock;
         }
+        export enum UBOShadowEnum {
+            MAT_LIGHT_VIEW_OFFSET = 0,
+            MAT_LIGHT_VIEW_PROJ_OFFSET = 16,
+            SHADOW_INV_PROJ_DEPTH_INFO_OFFSET = 32,
+            SHADOW_PROJ_DEPTH_INFO_OFFSET = 36,
+            SHADOW_PROJ_INFO_OFFSET = 40,
+            SHADOW_NEAR_FAR_LINEAR_SATURATION_INFO_OFFSET = 44,
+            SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET = 48,
+            SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET = 52,
+            SHADOW_COLOR_OFFSET = 56,
+            PLANAR_NORMAL_DISTANCE_INFO_OFFSET = 60,
+            COUNT = 64,
+            SIZE = 256
+        }
         /**
          * @en The uniform buffer object for 'cast shadow(fixed || csm)' && 'dir fixed area shadow' && 'spot shadow' && 'sphere shadow' && 'planar shadow'
          * @zh 这个 UBO 仅仅只给 'cast shadow(fixed || csm)' && 'dir fixed area shadow' && 'spot shadow' && 'sphere shadow' && 'planar shadow' 使用
          */
         export class UBOShadow {
-            static readonly MAT_LIGHT_VIEW_OFFSET = 0;
-            static readonly MAT_LIGHT_VIEW_PROJ_OFFSET: number;
-            static readonly SHADOW_INV_PROJ_DEPTH_INFO_OFFSET: number;
-            static readonly SHADOW_PROJ_DEPTH_INFO_OFFSET: number;
-            static readonly SHADOW_PROJ_INFO_OFFSET: number;
-            static readonly SHADOW_NEAR_FAR_LINEAR_SATURATION_INFO_OFFSET: number;
-            static readonly SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET: number;
-            static readonly SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET: number;
-            static readonly SHADOW_COLOR_OFFSET: number;
-            static readonly PLANAR_NORMAL_DISTANCE_INFO_OFFSET: number;
-            static readonly COUNT: number;
-            static readonly SIZE: number;
+            static readonly MAT_LIGHT_VIEW_OFFSET: UBOShadowEnum;
+            static readonly MAT_LIGHT_VIEW_PROJ_OFFSET: UBOShadowEnum;
+            static readonly SHADOW_INV_PROJ_DEPTH_INFO_OFFSET: UBOShadowEnum;
+            static readonly SHADOW_PROJ_DEPTH_INFO_OFFSET: UBOShadowEnum;
+            static readonly SHADOW_PROJ_INFO_OFFSET: UBOShadowEnum;
+            static readonly SHADOW_NEAR_FAR_LINEAR_SATURATION_INFO_OFFSET: UBOShadowEnum;
+            static readonly SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET: UBOShadowEnum;
+            static readonly SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET: UBOShadowEnum;
+            static readonly SHADOW_COLOR_OFFSET: UBOShadowEnum;
+            static readonly PLANAR_NORMAL_DISTANCE_INFO_OFFSET: UBOShadowEnum;
+            static readonly COUNT: UBOShadowEnum;
+            static readonly SIZE: UBOShadowEnum;
             static readonly NAME = "CCShadow";
             static readonly BINDING = PipelineGlobalBindings.UBO_SHADOW;
             static readonly DESCRIPTOR: gfx.DescriptorSetLayoutBinding;
             static readonly LAYOUT: gfx.UniformBlock;
         }
+        export enum UBOCSMEnum {
+            CSM_LEVEL_COUNT = 4,
+            CSM_VIEW_DIR_0_OFFSET = 0,
+            CSM_VIEW_DIR_1_OFFSET = 16,
+            CSM_VIEW_DIR_2_OFFSET = 32,
+            CSM_ATLAS_OFFSET = 48,
+            MAT_CSM_VIEW_PROJ_OFFSET = 64,
+            CSM_PROJ_DEPTH_INFO_OFFSET = 128,
+            CSM_PROJ_INFO_OFFSET = 144,
+            CSM_SPLITS_INFO_OFFSET = 160,
+            COUNT = 164,
+            SIZE = 656
+        }
         /**
          * @en The uniform buffer object only for dir csm shadow(level: 1 ~ 4)
          * @zh 级联阴影使用的UBO
          */
         export class UBOCSM {
-            static readonly CSM_LEVEL_COUNT = 4;
-            static readonly CSM_VIEW_DIR_0_OFFSET = 0;
-            static readonly CSM_VIEW_DIR_1_OFFSET: number;
-            static readonly CSM_VIEW_DIR_2_OFFSET: number;
-            static readonly CSM_ATLAS_OFFSET: number;
-            static readonly MAT_CSM_VIEW_PROJ_OFFSET: number;
-            static readonly CSM_PROJ_DEPTH_INFO_OFFSET: number;
-            static readonly CSM_PROJ_INFO_OFFSET: number;
-            static readonly CSM_SPLITS_INFO_OFFSET: number;
+            static readonly CSM_LEVEL_COUNT: UBOCSMEnum;
+            static readonly CSM_VIEW_DIR_0_OFFSET: UBOCSMEnum;
+            static readonly CSM_VIEW_DIR_1_OFFSET: UBOCSMEnum;
+            static readonly CSM_VIEW_DIR_2_OFFSET: UBOCSMEnum;
+            static readonly CSM_ATLAS_OFFSET: UBOCSMEnum;
+            static readonly MAT_CSM_VIEW_PROJ_OFFSET: UBOCSMEnum;
+            static readonly CSM_PROJ_DEPTH_INFO_OFFSET: UBOCSMEnum;
+            static readonly CSM_PROJ_INFO_OFFSET: UBOCSMEnum;
+            static readonly CSM_SPLITS_INFO_OFFSET: UBOCSMEnum;
             static readonly COUNT: number;
-            static readonly SIZE: number;
+            static readonly SIZE: UBOCSMEnum;
             static readonly NAME = "CCCSM";
             static readonly BINDING = PipelineGlobalBindings.UBO_CSM;
             static readonly DESCRIPTOR: gfx.DescriptorSetLayoutBinding;
             static readonly LAYOUT: gfx.UniformBlock;
@@ -23435,23 +23523,35 @@
         export const UNIFORM_SHADOWMAP_BINDING = PipelineGlobalBindings.SAMPLER_SHADOWMAP;
         export const UNIFORM_ENVIRONMENT_BINDING = PipelineGlobalBindings.SAMPLER_ENVIRONMENT;
         export const UNIFORM_DIFFUSEMAP_BINDING = PipelineGlobalBindings.SAMPLER_DIFFUSEMAP;
         export const UNIFORM_SPOT_SHADOW_MAP_TEXTURE_BINDING = PipelineGlobalBindings.SAMPLER_SPOT_SHADOW_MAP;
+        export enum UBOLocalEnum {
+            MAT_WORLD_OFFSET = 0,
+            MAT_WORLD_IT_OFFSET = 16,
+            LIGHTINGMAP_UVPARAM = 32,
+            LOCAL_SHADOW_BIAS = 36,
+            REFLECTION_PROBE_DATA1 = 40,
+            REFLECTION_PROBE_DATA2 = 44,
+            REFLECTION_PROBE_BLEND_DATA1 = 48,
+            REFLECTION_PROBE_BLEND_DATA2 = 52,
+            COUNT = 56,
+            SIZE = 224
+        }
         /**
          * @en The local uniform buffer object
          * @zh 本地 UBO。
          */
         export class UBOLocal {
-            static readonly MAT_WORLD_OFFSET = 0;
-            static readonly MAT_WORLD_IT_OFFSET: number;
-            static readonly LIGHTINGMAP_UVPARAM: number;
-            static readonly LOCAL_SHADOW_BIAS: number;
-            static readonly REFLECTION_PROBE_DATA1: number;
-            static readonly REFLECTION_PROBE_DATA2: number;
-            static readonly REFLECTION_PROBE_BLEND_DATA1: number;
-            static readonly REFLECTION_PROBE_BLEND_DATA2: number;
-            static readonly COUNT: number;
-            static readonly SIZE: number;
+            static readonly MAT_WORLD_OFFSET: UBOLocalEnum;
+            static readonly MAT_WORLD_IT_OFFSET: UBOLocalEnum;
+            static readonly LIGHTINGMAP_UVPARAM: UBOLocalEnum;
+            static readonly LOCAL_SHADOW_BIAS: UBOLocalEnum;
+            static readonly REFLECTION_PROBE_DATA1: UBOLocalEnum;
+            static readonly REFLECTION_PROBE_DATA2: UBOLocalEnum;
+            static readonly REFLECTION_PROBE_BLEND_DATA1: UBOLocalEnum;
+            static readonly REFLECTION_PROBE_BLEND_DATA2: UBOLocalEnum;
+            static readonly COUNT: UBOLocalEnum;
+            static readonly SIZE: UBOLocalEnum;
             static readonly NAME = "CCLocal";
             static readonly BINDING = ModelLocalBindings.UBO_LOCAL;
             static readonly DESCRIPTOR: gfx.DescriptorSetLayoutBinding;
             static readonly LAYOUT: gfx.UniformBlock;
@@ -23481,21 +23581,31 @@
             static readonly BINDING = ModelLocalBindings.UBO_LOCAL;
             static readonly DESCRIPTOR: gfx.DescriptorSetLayoutBinding;
             static readonly LAYOUT: gfx.UniformBlock;
         }
+        export enum UBOForwardLightEnum {
+            LIGHTS_PER_PASS = 1,
+            LIGHT_POS_OFFSET = 0,
+            LIGHT_COLOR_OFFSET = 4,
+            LIGHT_SIZE_RANGE_ANGLE_OFFSET = 8,
+            LIGHT_DIR_OFFSET = 12,
+            LIGHT_BOUNDING_SIZE_VS_OFFSET = 16,
+            COUNT = 20,
+            SIZE = 80
+        }
         /**
          * @en The uniform buffer object for forward lighting
          * @zh 前向灯光 UBO。
          */
         export class UBOForwardLight {
-            static readonly LIGHTS_PER_PASS = 1;
-            static readonly LIGHT_POS_OFFSET = 0;
-            static readonly LIGHT_COLOR_OFFSET: number;
-            static readonly LIGHT_SIZE_RANGE_ANGLE_OFFSET: number;
-            static readonly LIGHT_DIR_OFFSET: number;
-            static readonly LIGHT_BOUNDING_SIZE_VS_OFFSET: number;
-            static readonly COUNT: number;
-            static readonly SIZE: number;
+            static readonly LIGHTS_PER_PASS: UBOForwardLightEnum;
+            static readonly LIGHT_POS_OFFSET: UBOForwardLightEnum;
+            static readonly LIGHT_COLOR_OFFSET: UBOForwardLightEnum;
+            static readonly LIGHT_SIZE_RANGE_ANGLE_OFFSET: UBOForwardLightEnum;
+            static readonly LIGHT_DIR_OFFSET: UBOForwardLightEnum;
+            static readonly LIGHT_BOUNDING_SIZE_VS_OFFSET: UBOForwardLightEnum;
+            static readonly COUNT: UBOForwardLightEnum;
+            static readonly SIZE: UBOForwardLightEnum;
             static readonly NAME = "CCForwardLight";
             static readonly BINDING = ModelLocalBindings.UBO_FORWARD_LIGHTS;
             static readonly DESCRIPTOR: gfx.DescriptorSetLayoutBinding;
             static readonly LAYOUT: gfx.UniformBlock;
@@ -23539,20 +23649,29 @@
              * @internal This method only used init UBOSkinning configure.
              */
             static initLayout(capacity: number): void;
         }
+        export enum UBOMorphEnum {
+            MAX_MORPH_TARGET_COUNT = 60,
+            OFFSET_OF_WEIGHTS = 0,
+            OFFSET_OF_DISPLACEMENT_TEXTURE_WIDTH = 240,
+            OFFSET_OF_DISPLACEMENT_TEXTURE_HEIGHT = 244,
+            OFFSET_OF_VERTICES_COUNT = 248,
+            COUNT_BASE_4_BYTES = 64,
+            SIZE = 256
+        }
         /**
          * @en The uniform buffer object for morph setting
          * @zh 形变配置的 UBO
          */
         export class UBOMorph {
-            static readonly MAX_MORPH_TARGET_COUNT = 60;
-            static readonly OFFSET_OF_WEIGHTS = 0;
-            static readonly OFFSET_OF_DISPLACEMENT_TEXTURE_WIDTH: number;
-            static readonly OFFSET_OF_DISPLACEMENT_TEXTURE_HEIGHT: number;
-            static readonly OFFSET_OF_VERTICES_COUNT: number;
-            static readonly COUNT_BASE_4_BYTES: number;
-            static readonly SIZE: number;
+            static readonly MAX_MORPH_TARGET_COUNT: UBOMorphEnum;
+            static readonly OFFSET_OF_WEIGHTS: UBOMorphEnum;
+            static readonly OFFSET_OF_DISPLACEMENT_TEXTURE_WIDTH: UBOMorphEnum;
+            static readonly OFFSET_OF_DISPLACEMENT_TEXTURE_HEIGHT: UBOMorphEnum;
+            static readonly OFFSET_OF_VERTICES_COUNT: UBOMorphEnum;
+            static readonly COUNT_BASE_4_BYTES: UBOMorphEnum;
+            static readonly SIZE: UBOMorphEnum;
             static readonly NAME = "CCMorph";
             static readonly BINDING = ModelLocalBindings.UBO_MORPH;
             static readonly DESCRIPTOR: gfx.DescriptorSetLayoutBinding;
             static readonly LAYOUT: gfx.UniformBlock;
@@ -23562,22 +23681,33 @@
             static readonly BINDING = ModelLocalBindings.UBO_UI_LOCAL;
             static readonly DESCRIPTOR: gfx.DescriptorSetLayoutBinding;
             static readonly LAYOUT: gfx.UniformBlock;
         }
+        export enum UBOSHEnum {
+            SH_LINEAR_CONST_R_OFFSET = 0,
+            SH_LINEAR_CONST_G_OFFSET = 4,
+            SH_LINEAR_CONST_B_OFFSET = 8,
+            SH_QUADRATIC_R_OFFSET = 12,
+            SH_QUADRATIC_G_OFFSET = 16,
+            SH_QUADRATIC_B_OFFSET = 20,
+            SH_QUADRATIC_A_OFFSET = 24,
+            COUNT = 28,
+            SIZE = 112
+        }
         /**
          * @en The SH uniform buffer object
          * @zh 球谐 UBO。
          */
         export class UBOSH {
-            static readonly SH_LINEAR_CONST_R_OFFSET = 0;
-            static readonly SH_LINEAR_CONST_G_OFFSET: number;
-            static readonly SH_LINEAR_CONST_B_OFFSET: number;
-            static readonly SH_QUADRATIC_R_OFFSET: number;
-            static readonly SH_QUADRATIC_G_OFFSET: number;
-            static readonly SH_QUADRATIC_B_OFFSET: number;
-            static readonly SH_QUADRATIC_A_OFFSET: number;
-            static readonly COUNT: number;
-            static readonly SIZE: number;
+            static readonly SH_LINEAR_CONST_R_OFFSET: UBOSHEnum;
+            static readonly SH_LINEAR_CONST_G_OFFSET: UBOSHEnum;
+            static readonly SH_LINEAR_CONST_B_OFFSET: UBOSHEnum;
+            static readonly SH_QUADRATIC_R_OFFSET: UBOSHEnum;
+            static readonly SH_QUADRATIC_G_OFFSET: UBOSHEnum;
+            static readonly SH_QUADRATIC_B_OFFSET: UBOSHEnum;
+            static readonly SH_QUADRATIC_A_OFFSET: UBOSHEnum;
+            static readonly COUNT: UBOSHEnum;
+            static readonly SIZE: UBOSHEnum;
             static readonly NAME = "CCSH";
             static readonly BINDING = ModelLocalBindings.UBO_SH;
             static readonly DESCRIPTOR: gfx.DescriptorSetLayoutBinding;
             static readonly LAYOUT: gfx.UniformBlock;
@@ -26084,9 +26214,9 @@
          * @zh 使用自定义的天空盒材质
          */
         set skyboxMaterial(val: Material | null);
         get skyboxMaterial(): Material | null;
-        protected _envLightingType: number;
+        protected _envLightingType: renderer.scene.EnvironmentLightingType;
         protected _envmapHDR: TextureCube | null;
         protected _envmapLDR: TextureCube | null;
         protected _diffuseMapHDR: TextureCube | null;
         protected _diffuseMapLDR: TextureCube | null;
@@ -26599,9 +26729,9 @@
         /**
          * @en The event for target texture changing.
          * @zh 目标贴图修改的事件。
          */
-        static TARGET_TEXTURE_CHANGE: string;
+        static TARGET_TEXTURE_CHANGE: __private._cocos_misc_camera_component__CameraEvent;
         protected _projection: renderer.scene.CameraProjection;
         protected _priority: number;
         protected _fov: number;
         protected _fovAxis: renderer.scene.CameraFOVAxis;
@@ -26967,8 +27097,106 @@
     export class PrefabLink extends Component {
         prefab: Prefab | null;
         constructor();
     }
+    export enum DirectorEvent {
+        /**
+         * @en The event which will be triggered when the singleton of Director initialized.
+         * @zh Director 单例初始化时触发的事件
+         * @event INIT
+         */
+        INIT = "director_init",
+        /**
+         * @en The event which will be triggered when the singleton of Director reset.
+         * @zh Director 单例重置时触发的事件
+         * @event RESET
+         */
+        RESET = "director_reset",
+        /**
+         * @en The event which will be triggered before loading a new scene.
+         * @zh 加载新场景之前所触发的事件。
+         * @event BEFORE_SCENE_LOADING
+         */
+        BEFORE_SCENE_LOADING = "director_before_scene_loading",
+        /**
+         * @en The event which will be triggered before launching a new scene.
+         * @zh 运行新场景之前所触发的事件。
+         * @event BEFORE_SCENE_LAUNCH
+         */
+        BEFORE_SCENE_LAUNCH = "director_before_scene_launch",
+        /**
+         * @en The event which will be triggered after launching a new scene.
+         * @zh 运行新场景之后所触发的事件。
+         * @event AFTER_SCENE_LAUNCH
+         */
+        AFTER_SCENE_LAUNCH = "director_after_scene_launch",
+        /**
+         * @en The event which will be triggered at the beginning of every frame.
+         * @zh 每个帧的开始时所触发的事件。
+         * @event BEFORE_UPDATE
+         */
+        BEFORE_UPDATE = "director_before_update",
+        /**
+         * @en The event which will be triggered after engine and components update logic.
+         * @zh 将在引擎和组件 “update” 逻辑之后所触发的事件。
+         * @event AFTER_UPDATE
+         */
+        AFTER_UPDATE = "director_after_update",
+        /**
+         * @en The event which will be triggered before the rendering process.
+         * @zh 渲染过程之前所触发的事件。
+         * @event BEFORE_DRAW
+         */
+        BEFORE_DRAW = "director_before_draw",
+        /**
+         * @en The event which will be triggered after the rendering process.
+         * @zh 渲染过程之后所触发的事件。
+         * @event AFTER_DRAW
+         */
+        AFTER_DRAW = "director_after_draw",
+        /**
+         * @en The event which will be triggered before the pipeline render commit.
+         * @zh 当前渲染帧提交前所触发的事件。
+         * @event BEFORE_COMMIT
+         */
+        BEFORE_COMMIT = "director_before_commit",
+        /**
+         * @en The event which will be triggered before the render pipeline processes the render scene.
+         * @zh 当前帧将渲染场景提交到渲染管线之前所触发的事件。
+         * @event BEFORE_RENDER
+         */
+        BEFORE_RENDER = "director_before_render",
+        /**
+         * @en The event which will be triggered after the render pipeline finishes the rendering process on CPU.
+         * @zh 当前帧渲染管线渲染流程完成后所触发的事件。
+         * @event AFTER_RENDER
+         */
+        AFTER_RENDER = "director_after_render",
+        /**
+         * @en The event which will be triggered before the physics process.<br/>
+         * @zh 物理过程之前所触发的事件。
+         * @event BEFORE_PHYSICS
+         */
+        BEFORE_PHYSICS = "director_before_physics",
+        /**
+         * @en The event which will be triggered after the physics process.<br/>
+         * @zh 物理过程之后所触发的事件。
+         * @event AFTER_PHYSICS
+         */
+        AFTER_PHYSICS = "director_after_physics",
+        /**
+         * @en The event which will be triggered at the frame begin.<br/>
+         * @zh 一帧开始时所触发的事件。
+         * @event BEGIN_FRAME
+         */
+        BEGIN_FRAME = "director_begin_frame",
+        /**
+         * @en The event which will be triggered at the frame end.<br/>
+         * @zh 一帧结束之后所触发的事件。
+         * @event END_FRAME
+         */
+        END_FRAME = "director_end_frame"
+    }
     /**
      * @en
      * ATTENTION: USE `director` INSTEAD OF `Director`.
      * `director` is a singleton object which manage your game's logic flow.
@@ -26990,99 +27218,99 @@
          * @en The event which will be triggered when the singleton of Director initialized.
          * @zh Director 单例初始化时触发的事件
          * @event Director.EVENT_INIT
          */
-        static readonly EVENT_INIT = "director_init";
+        static readonly EVENT_INIT = DirectorEvent.INIT;
         /**
          * @en The event which will be triggered when the singleton of Director reset.
          * @zh Director 单例重置时触发的事件
          * @event Director.EVENT_RESET
          */
-        static readonly EVENT_RESET = "director_reset";
+        static readonly EVENT_RESET = DirectorEvent.RESET;
         /**
          * @en The event which will be triggered before loading a new scene.
          * @zh 加载新场景之前所触发的事件。
          * @event Director.EVENT_BEFORE_SCENE_LOADING
          */
-        static readonly EVENT_BEFORE_SCENE_LOADING = "director_before_scene_loading";
+        static readonly EVENT_BEFORE_SCENE_LOADING = DirectorEvent.BEFORE_SCENE_LOADING;
         /**
          * @en The event which will be triggered before launching a new scene.
          * @zh 运行新场景之前所触发的事件。
          * @event Director.EVENT_BEFORE_SCENE_LAUNCH
          */
-        static readonly EVENT_BEFORE_SCENE_LAUNCH = "director_before_scene_launch";
+        static readonly EVENT_BEFORE_SCENE_LAUNCH = DirectorEvent.BEFORE_SCENE_LAUNCH;
         /**
          * @en The event which will be triggered after launching a new scene.
          * @zh 运行新场景之后所触发的事件。
          * @event Director.EVENT_AFTER_SCENE_LAUNCH
          */
-        static readonly EVENT_AFTER_SCENE_LAUNCH = "director_after_scene_launch";
+        static readonly EVENT_AFTER_SCENE_LAUNCH = DirectorEvent.AFTER_SCENE_LAUNCH;
         /**
          * @en The event which will be triggered at the beginning of every frame.
          * @zh 每个帧的开始时所触发的事件。
          * @event Director.EVENT_BEFORE_UPDATE
          */
-        static readonly EVENT_BEFORE_UPDATE = "director_before_update";
+        static readonly EVENT_BEFORE_UPDATE = DirectorEvent.BEFORE_UPDATE;
         /**
          * @en The event which will be triggered after engine and components update logic.
          * @zh 将在引擎和组件 “update” 逻辑之后所触发的事件。
          * @event Director.EVENT_AFTER_UPDATE
          */
-        static readonly EVENT_AFTER_UPDATE = "director_after_update";
+        static readonly EVENT_AFTER_UPDATE = DirectorEvent.AFTER_UPDATE;
         /**
          * @en The event which will be triggered before the rendering process.
          * @zh 渲染过程之前所触发的事件。
          * @event Director.EVENT_BEFORE_DRAW
          */
-        static readonly EVENT_BEFORE_DRAW = "director_before_draw";
+        static readonly EVENT_BEFORE_DRAW = DirectorEvent.BEFORE_DRAW;
         /**
          * @en The event which will be triggered after the rendering process.
          * @zh 渲染过程之后所触发的事件。
          * @event Director.EVENT_AFTER_DRAW
          */
-        static readonly EVENT_AFTER_DRAW = "director_after_draw";
+        static readonly EVENT_AFTER_DRAW = DirectorEvent.AFTER_DRAW;
         /**
          * @en The event which will be triggered before the pipeline render commit.
          * @zh 当前渲染帧提交前所触发的事件。
          * @event Director.EVENT_BEFORE_COMMIT
          */
-        static readonly EVENT_BEFORE_COMMIT = "director_before_commit";
+        static readonly EVENT_BEFORE_COMMIT = DirectorEvent.BEFORE_COMMIT;
         /**
          * @en The event which will be triggered before the render pipeline processes the render scene.
          * @zh 当前帧将渲染场景提交到渲染管线之前所触发的事件。
          * @event Director.EVENT_BEFORE_RENDER
          */
-        static readonly EVENT_BEFORE_RENDER = "director_before_render";
+        static readonly EVENT_BEFORE_RENDER = DirectorEvent.BEFORE_RENDER;
         /**
          * @en The event which will be triggered after the render pipeline finishes the rendering process on CPU.
          * @zh 当前帧渲染管线渲染流程完成后所触发的事件。
          * @event Director.EVENT_AFTER_RENDER
          */
-        static readonly EVENT_AFTER_RENDER = "director_after_render";
+        static readonly EVENT_AFTER_RENDER = DirectorEvent.AFTER_RENDER;
         /**
          * @en The event which will be triggered before the physics process.<br/>
          * @zh 物理过程之前所触发的事件。
          * @event Director.EVENT_BEFORE_PHYSICS
          */
-        static readonly EVENT_BEFORE_PHYSICS = "director_before_physics";
+        static readonly EVENT_BEFORE_PHYSICS = DirectorEvent.BEFORE_PHYSICS;
         /**
          * @en The event which will be triggered after the physics process.<br/>
          * @zh 物理过程之后所触发的事件。
          * @event Director.EVENT_AFTER_PHYSICS
          */
-        static readonly EVENT_AFTER_PHYSICS = "director_after_physics";
+        static readonly EVENT_AFTER_PHYSICS = DirectorEvent.AFTER_PHYSICS;
         /**
          * @en The event which will be triggered at the frame begin.<br/>
          * @zh 一帧开始时所触发的事件。
          * @event Director.EVENT_BEGIN_FRAME
          */
-        static readonly EVENT_BEGIN_FRAME = "director_begin_frame";
+        static readonly EVENT_BEGIN_FRAME = DirectorEvent.BEGIN_FRAME;
         /**
          * @en The event which will be triggered at the frame end.<br/>
          * @zh 一帧结束之后所触发的事件。
          * @event Director.EVENT_END_FRAME
          */
-        static readonly EVENT_END_FRAME = "director_end_frame";
+        static readonly EVENT_END_FRAME = DirectorEvent.END_FRAME;
         static instance: Director;
         /**
          * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
          */
@@ -27357,17 +27585,17 @@
          * @zh
          * 当 showFPS 为 true 的时候界面的左下角将显示 fps 的信息,否则被隐藏。
          * @en
          * Left bottom corner fps information will show when "showFPS" equals true, otherwise it will be hide.
-         * @deprecated Since v3.6, Please use ```overrideSettings: { Settings.Category.PROFILING: { "showFPS": true }}``` to set this.
+         * @deprecated Since v3.6, Please use ```overrideSettings: { SettingsCategory.PROFILING: { "showFPS": true }}``` to set this.
          */
         showFPS?: boolean;
         /**
          * @zh
          * 设置想要的帧率你的游戏,但真正的FPS取决于你的游戏实现和运行环境。
          * @en
          * Set the wanted frame rate for your game, but the real fps depends on your game implementation and the running environment.
-         * @deprecated Since v3.6, Please use ```overrideSettings: { Settings.Category.SCREEN: { "frameRate": 60 }}``` to set this.
+         * @deprecated Since v3.6, Please use ```overrideSettings: { SettingsCategory.SCREEN: { "frameRate": 60 }}``` to set this.
          */
         frameRate?: number;
         /**
          * @zh
@@ -27384,59 +27612,59 @@
          * - 1 - Forced to use canvas renderer.
          * - 2 - Forced to use WebGL renderer, but this will be ignored on mobile browsers.
          * - 3 - Use Headless Renderer, which is useful in test or server env, only for internal use by cocos team for now
          * - 4 - Force WebGPU rendering, but this option will be ignored in some browsers.
-         * @deprecated Since v3.6, Please use ```overrideSettings: { Settings.Category.RENDERING: { "renderMode": 0 }}``` to set this.
+         * @deprecated Since v3.6, Please use ```overrideSettings: { SettingsCategory.RENDERING: { "renderMode": 0 }}``` to set this.
          */
         renderMode?: 0 | 1 | 2 | 3 | 4;
         /**
          * @en
          * Render pipeline resources
          * @zh
          * Render pipeline 资源
-         * @deprecated Since v3.6, Please use ```overrideSettings: { Settings.Category.RENDERING: { "renderPipeline": '' }}``` to set this.
+         * @deprecated Since v3.6, Please use ```overrideSettings: { SettingsCategory.RENDERING: { "renderPipeline": '' }}``` to set this.
          */
         renderPipeline?: string;
         /**
          * @en
          * Asset Manager initialization options
          * @zh
          * 资源管理器初始化设置
-         * @deprecated Since v3.6, Please use ```overrideSettings: { Settings.Category.ASSETS: {}}``` to set this.
+         * @deprecated Since v3.6, Please use ```overrideSettings: { SettingsCategory.ASSETS: {}}``` to set this.
          */
         assetOptions?: __private._cocos_asset_asset_manager_asset_manager__IAssetManagerOptions;
         /**
          * @en
          * GPU instancing options
          * @zh
          * GPU instancing 选项
-         * @deprecated Since v3.6, Please use ```overrideSettings: { Settings.Category.ANIMATION: { customJointTextureLayouts: [] }}``` to set this.
+         * @deprecated Since v3.6, Please use ```overrideSettings: { SettingsCategory.ANIMATION: { customJointTextureLayouts: [] }}``` to set this.
          */
         customJointTextureLayouts?: __private._cocos_3d_skeletal_animation_skeletal_animation_utils__ICustomJointTextureLayout[];
         /**
          * @en
          * Physics system config
          * @zh
          * 物理系统设置
-         * @deprecated Since v3.6, Please use ```overrideSettings: { Settings.Category.PHYSICS: {}}``` to set this.
+         * @deprecated Since v3.6, Please use ```overrideSettings: { SettingsCategory.PHYSICS: {}}``` to set this.
          */
         physics?: physics.IPhysicsConfig;
         /**
          * @en
          * The orientation from the builder configuration.
          * Available value can be 'auto', 'landscape', 'portrait'.
          * @zh
          * 屏幕旋转方向,可选 “自动”,“横屏”,“竖屏”
-         * @deprecated Since v3.6, Please use ```overrideSettings: { Settings.Category.SCREEN: { 'orientation': 'auto' }}``` to set this.
+         * @deprecated Since v3.6, Please use ```overrideSettings: { SettingsCategory.SCREEN: { 'orientation': 'auto' }}``` to set this.
          */
         orientation?: __private._pal_screen_adapter__ConfigOrientation;
         /**
          * @en
          * Determine whether the game frame exact fits the screen.
          * Now it only works on Web platform.
          * @zh
          * 是否让游戏外框对齐到屏幕上,目前只在 web 平台生效
-         * @deprecated Since v3.6, Please use ```overrideSettings: { Settings.Category.SCREEN: { 'exactFitScreen': true }}``` to set this.
+         * @deprecated Since v3.6, Please use ```overrideSettings: { SettingsCategory.SCREEN: { 'exactFitScreen': true }}``` to set this.
          */
         exactFitScreen?: boolean;
     }
     /**
@@ -33540,10 +33768,10 @@
      * 输入类单例,该单例管理所有的输入事件,包括:触摸、鼠标、加速计、游戏手柄、6DOF手柄、头戴显示器 和 键盘。
      *
      * @example
      * ```
-     * input.on(Input.EventType.DEVICEMOTION, this.onDeviceMotionEvent, this);
-     * input.off(Input.EventType.DEVICEMOTION, this.onDeviceMotionEvent, this);
+     * input.on(InputEventType.DEVICEMOTION, this.onDeviceMotionEvent, this);
+     * input.off(InputEventType.DEVICEMOTION, this.onDeviceMotionEvent, this);
      * ```
      */
     export const input: Input;
     /**
@@ -33556,10 +33784,10 @@
      * 你可以通过 `input` 获取到 `Input` 的实例。
      *
      * @example
      * ```
-     * input.on(Input.EventType.DEVICEMOTION, this.onDeviceMotionEvent, this);
-     * input.off(Input.EventType.DEVICEMOTION, this.onDeviceMotionEvent, this);
+     * input.on(InputEventType.DEVICEMOTION, this.onDeviceMotionEvent, this);
+     * input.off(InputEventType.DEVICEMOTION, this.onDeviceMotionEvent, this);
      * ```
      */
     export class Input {
         /**
@@ -36915,9 +37143,9 @@
         /**
          * @en Event type in dragonbones animation.
          * @zh 龙骨动画中的事件类型。
          */
-        export enum EventType {
+        export enum DragonBonesEventType {
             /**
              * @en Event about animation frame.
              * @zh 动画帧相关的事件。
              */
@@ -46646,9 +46874,9 @@
         SLIDER = 6,
         RELATIVE = 7,
         HINGE = 8
     }
-    export enum PhysicsGroup {
+    export enum PhysicsGroup2D {
         DEFAULT = 1
     }
     /**
      * @en Enum for ERaycast2DType.
@@ -46806,9 +47034,9 @@
          * Gets the predefined physics groups.
          * @zh
          * 获取预定义的物理分组。
          */
-        static get PhysicsGroup(): typeof PhysicsGroup;
+        static get PhysicsGroup(): typeof PhysicsGroup2D;
         /**
          * @en
          * Gets the physical system instance.
          * @zh
@@ -52520,9 +52748,9 @@
         /**
          * @en Enum for animation cache mode type.
          * @zh Spine 动画缓存类型。
          */
-        export enum AnimationCacheMode {
+        export enum SpineAnimationCacheMode {
             /**
              * @en Unset mode.
              * @zh 未设置模式。
              */
@@ -52588,9 +52816,9 @@
          * @extends UIRenderer
          */
         export class Skeleton extends UIRenderer {
             static SpineSocket: typeof SpineSocket;
-            static AnimationCacheMode: typeof AnimationCacheMode;
+            static AnimationCacheMode: typeof SpineAnimationCacheMode;
             protected _skeletonData: SkeletonData | null;
             protected defaultSkin: string;
             protected defaultAnimation: string;
             /**
@@ -52601,10 +52829,10 @@
              * 当图片的透明区域出现色块时需要关闭该选项,当图片的半透明区域颜色变黑时需要启用该选项。
              */
             protected _premultipliedAlpha: boolean;
             protected _timeScale: number;
-            protected _preCacheMode: AnimationCacheMode;
-            protected _cacheMode: AnimationCacheMode;
+            protected _preCacheMode: SpineAnimationCacheMode;
+            protected _cacheMode: SpineAnimationCacheMode;
             protected _sockets: SpineSocket[];
             protected _useTint: boolean;
             protected _debugMesh: boolean;
             protected _debugBones: boolean;
@@ -52661,10 +52889,10 @@
             /**
              * @en Animation mode, with options for real-time mode, private cached, or public cached mode.
              * @zh 动画模式,可选实时模式,私有 cached 或公共 cached 模式。
              */
-            get defaultCacheMode(): AnimationCacheMode;
-            set defaultCacheMode(mode: AnimationCacheMode);
+            get defaultCacheMode(): SpineAnimationCacheMode;
+            set defaultCacheMode(mode: SpineAnimationCacheMode);
             /**
              * @en Whether premultipliedAlpha enabled.
              * @zh 是否启用 alpha 预乘。
              */
@@ -52912,9 +53140,9 @@
              *
              * @example
              * skeleton.setAnimationCacheMode(sp.Skeleton.AnimationCacheMode.SHARED_CACHE);
              */
-            setAnimationCacheMode(cacheMode: AnimationCacheMode): void;
+            setAnimationCacheMode(cacheMode: SpineAnimationCacheMode): void;
             /**
              * @en Sets the bones and slots to the setup pose.
              * @zh 还原到起始动作。
              */
@@ -54192,8 +54420,18 @@
     export interface TiledRenderData {
         renderData: RenderData | null;
         texture: Texture2D | null;
     }
+    export interface ITiledLayerCullingRect {
+        leftDown: {
+            row: number;
+            col: number;
+        };
+        rightTop: {
+            row: number;
+            col: number;
+        };
+    }
     /**
      * @en Render the TMX layer.
      * @zh 渲染 TMX layer。
      * @class TiledLayer
@@ -54216,28 +54454,10 @@
             y: number;
             width: number;
             height: number;
         };
-        protected _cullingRect: {
-            leftDown: {
-                row: number;
-                col: number;
-            };
-            rightTop: {
-                row: number;
-                col: number;
-            };
-        };
-        get cullingRect(): {
-            leftDown: {
-                row: number;
-                col: number;
-            };
-            rightTop: {
-                row: number;
-                col: number;
-            };
-        };
+        protected _cullingRect: ITiledLayerCullingRect;
+        get cullingRect(): ITiledLayerCullingRect;
         protected _cullingDirty: boolean;
         protected _rightTop: {
             row: number;
             col: number;
@@ -55477,9 +55697,9 @@
         /**
          * @en The event types of [[Button]]. All button events are distributed by the owner Node, not the component
          * @zh [[Button]] 的事件类型,注意:事件是从该组件所属的 Node 上面派发出来的,需要用 node.on 来监听。
          */
-        static EventType: typeof __private._cocos_ui_button__EventType;
+        static EventType: typeof __private._cocos_ui_button__ButtonEventType;
         /**
          * @en
          * If Button is clicked, it will trigger event's handler.
          *
@@ -55656,9 +55876,9 @@
         /**
          * @en Keyboard event enumeration.
          * @zh 键盘的事件枚举。
          */
-        static EventType: typeof __private._cocos_ui_editbox_edit_box__EventType;
+        static EventType: typeof __private._cocos_ui_editbox_edit_box__EditBoxEventType;
         /**
          * @en
          * The event handler to be called when EditBox began to edit text.
          *
@@ -55820,19 +56040,19 @@
          *
          * @zh
          * 布局类型。
          */
-        get type(): __private._cocos_ui_layout__Type;
-        set type(value: __private._cocos_ui_layout__Type);
+        get type(): __private._cocos_ui_layout__LayoutType;
+        set type(value: __private._cocos_ui_layout__LayoutType);
         /**
          * @en
          * The are three resize modes for Layout. None, resize Container and resize children.
          *
          * @zh
          * 缩放模式。
          */
-        get resizeMode(): __private._cocos_ui_layout__ResizeMode;
-        set resizeMode(value: __private._cocos_ui_layout__ResizeMode);
+        get resizeMode(): __private._cocos_ui_layout__LayoutResizeMode;
+        set resizeMode(value: __private._cocos_ui_layout__LayoutResizeMode);
         /**
          * @en
          * The cell size for grid layout.
          *
@@ -55848,10 +56068,10 @@
          *
          * @zh
          * 起始轴方向类型,可进行水平和垂直布局排列,只有布局类型为 GRID 的时候才有效。
          */
-        get startAxis(): __private._cocos_ui_layout__AxisDirection;
-        set startAxis(value: __private._cocos_ui_layout__AxisDirection);
+        get startAxis(): __private._cocos_ui_layout__LayoutAxisDirection;
+        set startAxis(value: __private._cocos_ui_layout__LayoutAxisDirection);
         /**
          * @en
          * The left padding of layout, it only effect the layout in one direction.
          *
@@ -55912,20 +56132,20 @@
          *
          * @zh
          * 垂直排列子节点的方向。
          */
-        get verticalDirection(): __private._cocos_ui_layout__VerticalDirection;
-        set verticalDirection(value: __private._cocos_ui_layout__VerticalDirection);
+        get verticalDirection(): __private._cocos_ui_layout__LayoutVerticalDirection;
+        set verticalDirection(value: __private._cocos_ui_layout__LayoutVerticalDirection);
         /**
          * @en
          * Only take effect in horizontal layout mode.
          * This option changes the start element's positioning.
          *
          * @zh
          * 水平排列子节点的方向。
          */
-        get horizontalDirection(): __private._cocos_ui_layout__HorizontalDirection;
-        set horizontalDirection(value: __private._cocos_ui_layout__HorizontalDirection);
+        get horizontalDirection(): __private._cocos_ui_layout__LayoutHorizontalDirection;
+        set horizontalDirection(value: __private._cocos_ui_layout__LayoutHorizontalDirection);
         /**
          * @en
          * The padding of layout, it will effect the layout in horizontal and vertical direction.
          *
@@ -55940,10 +56160,10 @@
          *
          * @zh
          * 容器内布局约束。
          */
-        get constraint(): __private._cocos_ui_layout__Constraint;
-        set constraint(value: __private._cocos_ui_layout__Constraint);
+        get constraint(): __private._cocos_ui_layout__LayoutConstraint;
+        set constraint(value: __private._cocos_ui_layout__LayoutConstraint);
         /**
          * @en
          * The limit value used by the layout constraint inside the container.
          *
@@ -55964,47 +56184,47 @@
         /**
          * @en Layout type.
          * @zh 布局类型。
          */
-        static Type: typeof __private._cocos_ui_layout__Type;
+        static Type: typeof __private._cocos_ui_layout__LayoutType;
         /**
          * @en Vertical layout direction.
          * @zh 垂直方向布局方式。
          */
-        static VerticalDirection: typeof __private._cocos_ui_layout__VerticalDirection;
+        static VerticalDirection: typeof __private._cocos_ui_layout__LayoutVerticalDirection;
         /**
          * @en Horizontal layout direction.
          * @zh 水平方向布局方式。
          */
-        static HorizontalDirection: typeof __private._cocos_ui_layout__HorizontalDirection;
+        static HorizontalDirection: typeof __private._cocos_ui_layout__LayoutHorizontalDirection;
         /**
          * @en Layout Resize Mode.
          * @zh 缩放模式。
          */
-        static ResizeMode: typeof __private._cocos_ui_layout__ResizeMode;
+        static ResizeMode: typeof __private._cocos_ui_layout__LayoutResizeMode;
         /**
          * @en Grid Layout start axis direction.
          * @zh 布局轴向,只用于 GRID 布局。
          */
-        static AxisDirection: typeof __private._cocos_ui_layout__AxisDirection;
+        static AxisDirection: typeof __private._cocos_ui_layout__LayoutAxisDirection;
         /**
          * @en Layout constraint.
          * @zh 布局约束。
          */
-        static Constraint: typeof __private._cocos_ui_layout__Constraint;
-        protected _resizeMode: __private._cocos_ui_layout__ResizeMode;
-        protected _layoutType: __private._cocos_ui_layout__Type;
+        static Constraint: typeof __private._cocos_ui_layout__LayoutConstraint;
+        protected _resizeMode: __private._cocos_ui_layout__LayoutResizeMode;
+        protected _layoutType: __private._cocos_ui_layout__LayoutType;
         protected _cellSize: math.Size;
-        protected _startAxis: __private._cocos_ui_layout__AxisDirection;
+        protected _startAxis: __private._cocos_ui_layout__LayoutAxisDirection;
         protected _paddingLeft: number;
         protected _paddingRight: number;
         protected _paddingTop: number;
         protected _paddingBottom: number;
         protected _spacingX: number;
         protected _spacingY: number;
-        protected _verticalDirection: __private._cocos_ui_layout__VerticalDirection;
-        protected _horizontalDirection: __private._cocos_ui_layout__HorizontalDirection;
-        protected _constraint: __private._cocos_ui_layout__Constraint;
+        protected _verticalDirection: __private._cocos_ui_layout__LayoutVerticalDirection;
+        protected _horizontalDirection: __private._cocos_ui_layout__LayoutHorizontalDirection;
+        protected _constraint: __private._cocos_ui_layout__LayoutConstraint;
         protected _constraintNum: number;
         protected _affectedByScale: boolean;
         protected _isAlign: boolean;
         protected _layoutSize: math.Size;
@@ -56160,10 +56380,10 @@
          *
          * @zh
          * ScrollBar 的滚动方向。
          */
-        get direction(): __private._cocos_ui_scroll_bar__Direction;
-        set direction(value: __private._cocos_ui_scroll_bar__Direction);
+        get direction(): __private._cocos_ui_scroll_bar__ScrollBarDirection;
+        set direction(value: __private._cocos_ui_scroll_bar__ScrollBarDirection);
         /**
          * @en
          * Whether enable auto hide or not.
          *
@@ -56182,12 +56402,12 @@
          * 注意:只要当 “enableAutoHide” 为 true 时,才有效。
          */
         get autoHideTime(): number;
         set autoHideTime(value: number);
-        static Direction: typeof __private._cocos_ui_scroll_bar__Direction;
+        static Direction: typeof __private._cocos_ui_scroll_bar__ScrollBarDirection;
         protected _scrollView: ScrollView | null;
         protected _handle: Sprite | null;
-        protected _direction: __private._cocos_ui_scroll_bar__Direction;
+        protected _direction: __private._cocos_ui_scroll_bar__ScrollBarDirection;
         protected _enableAutoHide: boolean;
         protected _autoHideTime: number;
         protected _touching: boolean;
         protected _opacity: number;
@@ -56251,9 +56471,9 @@
      * @zh
      * 滚动视图组件。
      */
     export class ScrollView extends ViewGroup {
-        static EventType: typeof __private._cocos_ui_scroll_view__EventType;
+        static EventType: typeof __private._cocos_ui_scroll_view__ScrollViewEventType;
         /**
          * @en
          * The elapse time of bouncing back. A value of 0 will bounce back immediately.
          *
@@ -56833,9 +57053,9 @@
         /**
          * @en Enum for toggle event.
          * @zh toggle 事件枚举。
          */
-        static ...*[Comment body truncated]*

@@ -151,7 +151,7 @@ enum SizeMode {
}
ccenum(SizeMode);

enum EventType {
export enum SpriteEventType {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The functionality of inline enum doesn't allow the same name, so add a prefix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant